﻿using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ZFB.Models.EntityConfig
{
    public class RegionsConfig : IEntityTypeConfiguration<T_Regions>
    {
        public void Configure(EntityTypeBuilder<T_Regions> builder)
        {
            builder.ToTable("T_Regions");
            
            builder.HasMany(e=>e.T_Communities).WithOne(e=>e.T_Regions).HasForeignKey(e => e.RegionId).OnDelete(DeleteBehavior.Restrict);
        }
    }
}
